<gm:page title="My App" authenticate="false" onload="load();">
 
<h1>Hello World!</h1>
 
<gm:list id="placesList" data="http://www.google.com/base/feeds/snippets/-/hike%20reviews/" pagesize="10" template="diggTemplate">
  <gm:handleEvent event="repaint" execute="loadKmls();"/> 
</gm:list>

<h2>Mapa</h2>


<gm:map id="mainMap" lat="-27.5983688685"  lng="-48.51356506347" zoom="11" maptypes="true" height="100%" 
   data="${placesList}" control="large" latref="g:lat" lngref="g:long" infotemplate="infoTemplate">
</gm:map>

      
<!-- templates -->
<gm:template id="diggTemplate">
    <table>
      <tr repeat="true">
        <td><gm:text ref="atom:title"/></td>
        <td><gm:text ref="atom:content"/></td>
      </tr>
    </table>
</gm:template>

<!-- Balão de Texto no Mapa --> 
<gm:template id="infoTemplate">
<table  width="300">
<tr><td colspan="2"><p><b><gm:text ref="atom:title"/></b></p> </td></tr>
<tr><td colspan="2"><gm:html ref="atom:content"/></td></tr>
</table>    
</gm:template>
  
<script>
  
function load(){
   map = google.mashups.getObjectById('mainMap').getMap();
   map.setMapType(G_SATELLITE_MAP);
   map.enableDoubleClickZoom();
}
  
  function kml(url) 
  {
    var myMap = google.mashups.getObjectById('mainMap').getMap();
    var geoXml = new GGeoXml(url);
    myMap.addOverlay(geoXml);
  }
  
  function loadKmls() {
    alert("Load");
    var myListData = google.mashups.getObjectById('placesList').getData();
    var urlGPath = new GPath("g:kml_link");
    var i=0;
    for (i = 0; i < myListData.size(); i++) {
      var entry = myListData.entryAt(i);
      var urlString = urlGPath.getValue(entry);
      kml(urlString);
    }
};


</script>  



</gm:page>